-- card: 11661 from stack: in -- bmap block id: 11899 -- flags: 0000 -- background id: 8327 -- name: LSC Utilities ----- HyperTalk script ----- on opencard set the visible of field 1 to false -- background field set the visible of card field "oh well" to false set the scroll of card field 1 to 0 set the visible of button "put" to false set the visible of button "get" to false end opencard on closecard set the visible of field 1 to true end closecard -- part 5 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=18 top=32 right=290 bottom=486 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 20 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: XCMD Text -- part 6 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=304 top=299 right=321 bottom=425 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Show LSC Source ----- HyperTalk script ----- on mouseUp get the visible of card field "source" set the visible of card field "source" to not it if it is false then set the name of me to "Hide LSC Source" else set the name of me to "Show LSC Source" end if end mouseUp -- part 7 (field) -- low flags: 81 -- high flags: 0007 -- rect: left=18 top=31 right=291 bottom=486 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: source -- part 8 (field) -- low flags: 80 -- high flags: 0002 -- rect: left=18 top=24 right=285 bottom=482 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: oh well -- part 9 (button) -- low flags: 80 -- high flags: 8003 -- rect: left=154 top=289 right=307 bottom=189 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Put ----- HyperTalk script ----- on mouseUp -- You may have to change the parmater list to suit your configuration -- NOTE: This button is a self contained operation of open, put,close. -- You DO NOT have to open and close every time you get or put. -- Just open once and start once, like when you open and close -- your stack. get SerialHandler("open","A",9600,8,none,1,"XON/XOFF") if it is not empty then put "Error: "&&it&&" (See script of "put" button)" end if get Serialhandler("put","A",the script of me) if it is not empty then put "Error: "&&it end if get Serialhandler("close","A") end mouseUp -- part 10 (button) -- low flags: 80 -- high flags: 8003 -- rect: left=187 top=306 right=324 bottom=223 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Get ----- HyperTalk script ----- on mouseUp -- You may have to change the parmater list to suit your configuration -- NOTE: This button is a self contained operation of open, put,close. -- You DO NOT have to open and close every time you get or put. -- Just open once and start once, like when you open and close -- your stack. get SerialHandler("open","A",9600,8,none,1,"XON/XOFF") set the visible of card field "got" to true put empty into card field "got" put "Click the mouse when done." repeat while the mouse is up get SerialHandler("get","A",60) put it after card field "got" end repeat get SerialHandler("close","A") set the visible of card field "got" to false put empty into msg end mouseUp -- part 11 (field) -- low flags: 80 -- high flags: 0007 -- rect: left=18 top=32 right=285 bottom=481 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: got -- part contents for card part 5 ----- text ----- LSC Utilities Roger Brown This is a collection of various C functions that are useful when creating XFCNs. They are written in LightSpeed C. Included are: • Number of HyperCard Items : int NumHCitems(char *source) Given a pointer to a source of HyperCard formatted items (comma delimited), return the number of items in it. • Get HyperCard Item : GetHCItem(char *inStr, int i, char *outStr) Given a HyperCard item list (comma delimited) in string inStr, get item i and return it as a string in outStr. • Number of HyperCard Lines : int NumHCLines(char *source) Given a pointer to a source of HyperCard formatted lines, such as a field, return the number of lines in it. • Get HyperCard Line : GetHCLine(int ine, char *source, char *dest) Given a pointer to a source of lines (like a field), extract the requested line and return it in string dest. • Get HyperCard Expression : GetHCExpression(char *inStr, char *outStr) Given a HyperCard expression in inString, return its value in outStr. • String Contains : StrContains(char *target, char *test) Given string test, return TRUE if it contains the string target. • Get HyperCard Rectangle : GetCardRect(Rect *itsRect) Get the rectangle of HyperCard's card window. • Build a return result : ResultIs(XCmdBlockPtr paramPtr, char *theResult) Given a C formatted string, build a return result structure for the given parameter block. -- part contents for card part 7 ----- text ----- /* HCLib1.0a1.c */ /* © Trustees of Dartmouth College */ /* written in LightSpeed C © Think Technologies, Inc */ /* by Roger Brown 7/7/88 Courseware Development group */ /* HyperCard XCMD support library */ #include "QuickDraw.h" #include "FontMgr.h" #include "EventMgr.h" #include "WindowMgr.h" #include "MenuMgr.h" #include "MemoryMgr.h" #include "ResourceMgr.h" #include "ToolboxUtil.h" #include "ControlMgr.h" #include "DialogMgr.h" #include "HyperXCmd.h" #include "XCmdGlue.inc.c" /* Get the number of HyperCard comma delimited items in string s. */ int NumHCItems(s) char *s; { int c; /* character pointer */ int len; /* length of string */ int count; /* count of items found */ int j; /* item byte counter */ count = j = 0; /* initialize */ len = strlen(s); /* will look this far */ for (c=0;c 255 characters."); return; } if (c==(len-1)) { /* last item, no comma */ count = count+1; break; } } } if (count < i) strcpy(outStr,"Error: item out of range"); /* no item there */ else { temp[j] = 0; /* make it a C string */ strcpy(outStr,temp); /* move to output string */ } return; } /* how many HyperCard lines in string source */ NumHCLines(source) char *source; { int c; /* character counter */ int l; /* line counter */ int len; len = strlen(source); l = 0; for (c=0;clen) { /* out of range */ strcpy(dest,"Error: Line out of range."); return; } } c = 0; /* at line, start transfer */ for (j=i;jleft = (int)corner; GetHCItem(str,2,it); CtoPstr(it); StringToNum(it,&corner); itsRect->top = (int)corner; GetHCItem(str,3,it); CtoPstr(it); StringToNum(it,&corner); itsRect->right = (int)corner; GetHCItem(str,4,it); CtoPstr(it); StringToNum(it,&corner); itsRect->bottom = (int)corner; } /* build a return result structure from a string */ ResultIs(paramPtr,theResult) XCmdBlockPtr paramPtr; char *theResult; { long len; Handle resultHandle; len = 1+strlen(theResult); resultHandle = NewHandle(len); BlockMove(theResult,*resultHandle,len); paramPtr->returnValue = resultHandle; } -- part contents for card part 8 ----- text ----- Alas, this demonstration will show you nothing of interest unless you have a serial device attached to your Mac. Like an Imagewriter, or a terminal if you want to get input.